﻿using System;
using System.Runtime.Serialization;

namespace RuTracker.Interface
{
    [DataContract]
    public class RuTrackerMessage
    {
        /// <summary>
        /// Default .ctor for XML serialization
        /// </summary>
        public RuTrackerMessage()
        {}

        public RuTrackerMessage(string topic, string path, byte[] token)
        {
            if (string.IsNullOrEmpty(topic))
                throw new ArgumentNullException("topic");

            if (string.IsNullOrEmpty(path))
                throw new ArgumentNullException("path");

            if (token == null || token.Length == 0)
                throw new ArgumentNullException("token");

            Topic = topic;
            Path = path;
            Token = token;
            Attempt = 1;
        }

        [DataMember]
        public string Topic { get; set; }
        [DataMember]
        public string Path { get; set; }
        [DataMember]
        public byte[] Token { get; set; }
        [DataMember]
        public string EMail { get; set; }
        [DataMember]
        public int Attempt { get; set; }
    }
}
